<?php

class GamePreLoginAction extends SzAbstractAction
{
    protected $paramTypes = array(
        SzAbstractAction::TYPE_STRING,
        SzAbstractAction::TYPE_STRING,
    );

    /**
     * 获取平台sessionKey和openid
     * @param $code
     * @param $platformId
     * @return SzResponse
     * @throws SzException
     */
    public function execute($code,$platformId)
    {
        if (!$platformId || $platformId == "null" || $platformId == "" || $platformId == "false") {
            throw new SzException(20004, array($platformId));
        }
        if (!$code || $code == "null" || $code == "" || $code == "false") {
            throw new SzException(20004, array($code));
        }
        $res = PlatformTT::get()->getOpenidSessionKey($code);

        return $this->buildResponse($res);
    }
}